package com.lancoo.znbkxx.teacher.widget.newBarChart;

import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;

import java.util.List;

public class XAxisValueFormatter implements IAxisValueFormatter {



    private List<String> mValues;



    public XAxisValueFormatter(List<String> values) {

        this.mValues = values;

    }



    @Override

    public String getFormattedValue(float value, AxisBase axis) {

        int x=(int)(value);

        if (x<0)

            x=0;

        if (x>=mValues.size())

            x=mValues.size()-1;

        return mValues.get(x);

    }

}
